package bobaini.com.controller;

import bobaini.com.annotation.LoginUser;
import bobaini.com.annotation.TokenNotValidation;
import bobaini.com.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuyi
 * ClassName: Test
 * Version: 1.0.0
 * DateTime: 2021/03/31-10:36:00
 * Description: TODO
 */
@RestController
@RequestMapping("/api")
@Slf4j
public class AuthorityController {

    @PostMapping("/yes")
    public String yesLeads(@LoginUser User user) {
        System.out.println("需要token才可以访问，呵呵……");
        log.info("user：" + user.toString());
        return "不加上注解11111";
    }

    @PostMapping("/no")
    @TokenNotValidation
    public String noLeads() {
        System.out.println("不用token就可以访问……");
        return "加上注解22222";
    }

}
